home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / pdc / libsrc / stringlib / strrchr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-04-07  |  431 b   |  25 lines

  1. /*
  2.  * strrchr - find last occurrence of a character in a string
  3.  */
  4.  
  5. #include "config.h"
  6.  
  7. #define    NULL    0
  8.  
  9. char *                /* found char, or NULL if none */
  10. strrchr(s, charwanted)
  11. CONST char *s;
  12. register char charwanted;
  13. {
  14.     register CONST char *scan;
  15.     register CONST char *place;
  16.  
  17.     place = NULL;
  18.     for (scan = s; *scan != '\0'; scan++)
  19.         if (*scan == charwanted)
  20.             place = scan;
  21.     if (charwanted == '\0')
  22.         return(scan);
  23.     return(place);
  24. }
  25.